﻿using AutoTest.Domain.Enums;
using AutoTest.Framework.Pager;

namespace AutoTest.Business.Dto.UserInfo
{
    /// <summary>
    /// 搜索
    /// </summary>
    public class UserInfoSearchDto
    {
        /// <summary>
        /// 关键字
        /// </summary>
        public string Keyword { get; set; } = string.Empty;

        /// <summary>
        /// 电话
        /// </summary>
        public string Phone { get; set; } = string.Empty;

        /// <summary>
        /// 用户名
        /// </summary>
        public string UserName { get;set; } = string.Empty;

        /// <summary>
        /// 性别
        /// </summary>
        public EnumSex? Sex { get; set; }
    }

    /// <summary>
    /// 分页搜索Dto
    /// </summary>
    public class UserInfoPageSearchDto : UserInfoSearchDto, IPagedSearchDto
    {
        private int _pageIndex = 1;

        /// <inheritdoc/>
        public int PageIndex
        {
            get { return _pageIndex; }
            set { _pageIndex = value > 0 ? value : 1; }
        }

        private int _pageSize = 20;

        /// <inheritdoc/>
        public int PageSize
        {
            get { return _pageSize; }
            set { _pageSize = value > 0 ? value : 20; }
        }
    }
}
